package mzt.ns.parse;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import mzt.ns.parse.pojo.JsonRootBean;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.jsoup.Connection;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import org.junit.Test;

import java.io.IOException;
import java.util.List;

/**
 * @author study
 * @version 1.0
 * @date 2020/8/9 16:23
 */
public class Album {
    @Test
    public void parse() throws IOException {
        Document root = Jsoup.connect("https://www.nvshens.org/girl/27717/")
                .get();
        //girlid
        Elements album = root.select(".archive_more a");
        System.out.println(album.text());

        // pageNum
        // =
    }

    @Test
    public void base() throws IOException {
        System.out.println(System.currentTimeMillis());
        String url = "https://www.jisilu.cn/data/cbnew/cb_list/?___jsl=LST___t=%s";
        Connection.Response execute = Jsoup.connect(String.format(url, System.currentTimeMillis()))
                .ignoreContentType(true)
                .execute();

        //使用execute 请求返回数据不包含 html,get()会返回html

        String body = execute.body();
        System.out.println(body);
        JSONObject jsonObject = JSONObject.parseObject(body);
        String rows = jsonObject.getString("rows");
        List<JsonRootBean> beans = JSONObject.parseArray(rows, JsonRootBean.class);
        System.out.println(beans);

        System.out.println(rows);

    }
}
